import React from 'react';
import { ck_date, loc, KTimeRange, KSelect, ck_empty, useKForm, KDlg } from 'sui';

const get_fix = () => {
    return [
        {sn: "day", name: loc("l_670"), cl: "#48BB78"},
        {sn: "mid", name: loc("l_672"), cl: "#ffc400"},
        {sn: "night", name: loc("l_671"), cl: "#4299E1"},
    ];
};

const DlgVal = (props) => {
    const form = useKForm(props.data);

    const ck = {
        sn: (v) => ck_empty(v),
        start: (v) => ck_date(v),
        end: (v) => ck_date(v),
    };

    return (
        <KDlg {...props} title={loc("l_248")} ck={ck} form={form} width="md">
            <div className="flex flex-col">
                <KSelect label={loc("l_229")} name="sn" form={form} lst={get_fix()}/>
                <KTimeRange form={form}/>
            </div>
        </KDlg>
    );
};

export {get_fix, DlgVal};
